package com.tn.service.vehicle;

import com.tn.controller.alarm.common.model.PageInput;
import com.tn.controller.alarm.common.model.PageResult;
import com.tn.controller.alarm.common.model.rpm.mq.EventMQDTO;
import com.tn.controller.alarm.common.model.vehicle.entity.VehicleInfoDO;
import com.tn.controller.alarm.common.model.vehicle.vo.VehicleInParam;
import com.tn.controller.alarm.common.model.vehicle.vo.VehicleTaskInfoVO;
import com.tn.controller.alarm.common.model.vehicle.vo.VehicleWorkWeightVO;
import com.tn.exception.DatabaseOperationFailedException;

import java.util.List;

/**
 * 装载车service
 *
 * @program: tn_aucy_java
 * @author: yangjiayao
 * @create: 2022/03/01
 */
public interface IVehicleService {
    /**
     * 查询空闲的装载车
     *
     * @return 装载车信息
     */
    List<VehicleInfoDO> queryInactiveVehicle();

    /**
     * 司机是否已绑定装载车
     *
     * @param driver 司机
     * @return 是否绑定装载车
     */
    VehicleInfoDO isBoundDriver(String driver);

    /**
     * 绑定装载车和司机
     *
     * @param vehicleId 装载车ID
     * @param driver    司机
     */
    void boundDriver(int vehicleId, String driver) throws DatabaseOperationFailedException;

    /**
     * 解绑装载车和司机
     *
     * @param driver 司机
     */
    void unboundDriver(String driver) throws DatabaseOperationFailedException;

    /**
     * 查询装载车理货信息
     *
     * @param vehicleId 装载车ID
     * @return 装载车信息
     */
    List<VehicleTaskInfoVO> queryVehicleTaskInfo(int vehicleId);

    /**
     * 达到距离，状态改为可下发
     *
     * @param tagId 标签ID
     * @return 修改结果
     */
    boolean becomeReachable(String tagId);

    /**
     * 超出距离，状态改为不可下发
     *
     * @param tagId 标签ID
     * @return 修改结果
     */
    boolean becomeUnreachable(String tagId);

    /**
     * 下发
     *
     * @param taskId 理货任务Id
     */
    VehicleTaskInfoVO sendCall(int taskId, int vehicleId, String license) throws DatabaseOperationFailedException;

    /**
     * 取消下发
     *
     * @param taskId 理货任务Id
     */
    VehicleTaskInfoVO cancelCall(int taskId, String license) throws DatabaseOperationFailedException;

    /**
     * 匹配
     *
     * @param taskId 理货任务Id
     */
    VehicleTaskInfoVO matched(int taskId) throws DatabaseOperationFailedException;

    /**
     * 暂停
     *
     * @param taskId 理货任务Id
     */
    VehicleTaskInfoVO pausedTask(int taskId) throws DatabaseOperationFailedException;

    /**
     * 继续
     *
     * @param taskId 理货任务Id
     */
    VehicleTaskInfoVO continueTask(int taskId) throws DatabaseOperationFailedException;

    /**
     * 完成
     *
     * @param taskId 理货任务Id
     */
    void completeTask(int taskId) throws DatabaseOperationFailedException;

    /**
     * 查询装载车历史理货记录
     *
     * @param pageParam 装载车ID
     * @return 装载车信息
     */
    PageResult<VehicleTaskInfoVO> queryHisTaskInfo(PageInput<VehicleInParam> pageParam);

    /**
     * 查询工作量情况
     *
     * @param vehicleId 装载车ID
     * @return 工作量情况
     */
    VehicleWorkWeightVO queryWorkWeight(int vehicleId);

    /**
     * 装载车告警信息处理
     *
     * @param eventMQDTORpmMqDTO 告警信息
     */
    void vehicleAlarmDataHandle(EventMQDTO eventMQDTORpmMqDTO);
}
